<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>候选人 - AI面试官</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/boxicons@2.0.7/css/boxicons.min.css" rel="stylesheet">
    <style>
        :root {
            --primary-color: #4a90e2;
            --secondary-color: #f8f9fa;
            --text-primary: #2c3e50;
            --text-secondary: #6c757d;
            --success-color: #28a745;
            --warning-color: #ffc107;
            --danger-color: #dc3545;
            --border-radius: 12px;
            --transition: all 0.3s ease;
        }

        body {
            background-color: #f4f6f9;
            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
            padding: 30px;
        }

        .page-container {
            max-width: 1400px;
            margin: 0 auto;
        }

        .page-title {
            color: var(--text-primary);
            font-size: 2rem;
            margin-bottom: 30px;
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .page-title i {
            color: var(--primary-color);
        }

        .candidates-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 25px;
            padding: 20px 0;
        }

        .candidate-card {
            background: white;
            border-radius: var(--border-radius);
            box-shadow: 0 2px 12px rgba(0,0,0,0.08);
            padding: 20px;
            transition: var(--transition);
        }

        .candidate-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 4px 20px rgba(0,0,0,0.12);
        }

        .candidate-header {
            display: flex;
            align-items: center;
            margin-bottom: 20px;
            gap: 15px;
        }

        .candidate-avatar {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background-color: var(--primary-color);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 24px;
            font-weight: bold;
        }

        .candidate-info {
            flex-grow: 1;
        }

        .candidate-name {
            font-size: 1.2rem;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 5px;
        }

        .candidate-job {
            color: var(--text-secondary);
            font-size: 0.9rem;
        }

        .score-section {
            background: var(--secondary-color);
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 15px;
        }

        .total-score {
            font-size: 2rem;
            font-weight: bold;
            color: var(--primary-color);
            text-align: center;
            margin-bottom: 10px;
        }

        .score-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
        }

        .score-item {
            text-align: center;
        }

        .score-label {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-bottom: 5px;
        }

        .score-value {
            font-weight: 600;
            color: var(--text-primary);
        }

        .candidate-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 15px;
            padding-top: 15px;
            border-top: 1px solid var(--secondary-color);
        }

        .candidate-meta {
            font-size: 0.9rem;
            color: var(--text-secondary);
        }

        .view-button {
            padding: 8px 15px;
            background: var(--primary-color);
            color: white;
            border-radius: 6px;
            text-decoration: none;
            font-size: 0.9rem;
            transition: var(--transition);
        }

        .view-button:hover {
            background: #357abd;
            color: white;
        }


    </style>
</head>
<body>
    <div class="page-container">
        <div class="d-flex justify-content-between align-items-center mb-4">
            <h1 class="page-title mb-0">
                <i class='bx bx-user-pin'></i>
                候选人
            </h1>
            <div class="d-flex gap-3 align-items-center">
                <div class="form-check form-switch">
                    <input class="form-check-input" type="checkbox" id="showAllScores" {% if show_all %}checked{% endif %}>
                    <label class="form-check-label" for="showAllScores">显示所有分数</label>
                </div>
                <a href="/api/job_detail/{{ job_id }}" class="btn btn-outline-primary">
                    <i class='bx bx-arrow-back'></i>
                    返回职位详情
                </a>
            </div>
        </div>

        {% if not candidates %}
        <div class="alert alert-info">
            暂无符合条件的候选人
        </div>
        {% endif %}

        <div class="candidates-grid">
            {% for candidate in candidates %}
            <div class="candidate-card">
                <div class="candidate-header">
                    <div class="candidate-avatar">
                        {{ candidate.full_name[0] }}
                    </div>
                    <div class="candidate-info">
                        <div class="candidate-name">{{ candidate.full_name }}</div>
                        <div class="candidate-job">{{ candidate.job_title }}</div>
                    </div>
                </div>

                <div class="score-section">
                    <div class="total-score">{{ "%.1f"|format(candidate.total_score) }}分</div>
                    <div class="score-grid">
                        <div class="score-item">
                            <div class="score-label">技术能力</div>
                            <div class="score-value">{{ "%.1f"|format(candidate.technical_ability) }}分</div>
                        </div>
                        <div class="score-item">
                            <div class="score-label">学习能力</div>
                            <div class="score-value">{{ "%.1f"|format(candidate.learning_ability) }}分</div>
                        </div>
                        <div class="score-item">
                            <div class="score-label">团队协作</div>
                            <div class="score-value">{{ "%.1f"|format(candidate.team_collaboration) }}分</div>
                        </div>
                        <div class="score-item">
                            <div class="score-label">解决问题</div>
                            <div class="score-value">{{ "%.1f"|format(candidate.problem_solving) }}分</div>
                        </div>
                        <div class="score-item">
                            <div class="score-label">沟通交流</div>
                            <div class="score-value">{{ "%.1f"|format(candidate.communication_expression) }}分</div>
                        </div>
                    </div>
                </div>

                <div class="candidate-meta">
                    <div><i class='bx bx-book'></i> 学历：{{ candidate.education }}</div>
                    <div><i class='bx bx-time'></i> 工作年限：{{ candidate.experience_years }}年</div>
                    <div><i class='bx bx-calendar'></i> 申请时间：{{ candidate.apply_time }}</div>
                </div>

                <div class="candidate-footer">
                    <a href="/api/interview_report/{{ candidate.application_id }}" class="view-button">
                        <i class='bx bx-file'></i>
                        查看面试报告
                    </a>
                </div>
            </div>
            {% endfor %}
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        document.getElementById('showAllScores').addEventListener('change', function() {
            const currentUrl = new URL(window.location.href);
            currentUrl.searchParams.set('show_all', this.checked);
            window.location.href = currentUrl.toString();
        });
    </script>
</body>
</html> 